import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;

public class MyTekstView extends JPanel implements ActionListener{

	private JTextArea textfield = new JTextArea();
	private int rodevlak1;
	private int rodevlak2;
	private int rodevlak3;
	private int rodevlak4;
	private int rodevlak5;
	private int rodevlak6;
	DobbelsteenModel d;
	
	public MyTekstView(){
		this.setLayout(new FlowLayout());
		this.add(textfield);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		d = (DobbelsteenModel) e.getSource();
		if(d.getWaarde() == 1){
			rodevlak1++;
		} else if(d.getWaarde() == 2){
			rodevlak2++;
		} else if(d.getWaarde() == 3){
			rodevlak3++;
		} else if(d.getWaarde() == 4){
			rodevlak4++;
		} else if(d.getWaarde() == 5){
			rodevlak5++;
		} else if(d.getWaarde() == 6){
			rodevlak6++;
		}
		textfield.setText("Waardes" + "\n" + "1 : " + rodevlak1 + "\n" + "2 : " + rodevlak2 + "\n3 : " + rodevlak3 +
				"\n4 : " + rodevlak4 + "\n5 : " + rodevlak5 + "\n6 : " + rodevlak6);
		
	}
}
